package middlewareorid.engine;

import waba.util.Vector;

/*
 * This class created cause by Superwaba not support :
 * - String.split()
 * - StringTokenizer() 
 */
public abstract class StringEngine {
	
	public static String[] split(String data, String token) {
		String result[];
		Vector vtemp = new Vector();
		int start = 0;
		int end = 1;
		int cntr = 1;
		
		String str = "";
		while (end > 0) {
			end = data.indexOf(token, start+1);
			if (end > 0) {
				str = data.substring(start, end);
			} else {
				str = data.substring(start, data.length());
			}
			if (!(str.equals(""))) vtemp.insert(cntr,str);
			//Vm.debug("Start : " + start + " end : " + end);
			start = end+2;
			cntr++;
		}
		
		result = (String[]) vtemp.toObjectArray();
		return result;
	}
}
